<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Knowledge extends CI_Controller {
	var $key = '装修常识';
	
	public function index()
	{
		$id = $this->input->get_post('id');
				
		$this->load->config('knowledge');
		$knowledge = $this->config->item('knowledge');
		
		if($id == ''){
			$data['knowledge'] = $knowledge;
			$data['key'] = $this->key;
			$this->load->view('/knowledge/list', $data);
			return;
		}
			
		if( ! isset($knowledge[$id])){
			echo '装修常识文章不存在';
			return;
		}
		
		$data['knowledge'] = $knowledge[$id];
		$data['key'] = $this->key;
		 
		$this->load->view('/knowledge/detail', $data);	
	}
}